home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 219 < prev    next >
Encoding:
Text File  |  1996-08-06  |  2.4 KB  |  68 lines

  1. Path: fido.asd.sgi.com!austern
  2. From: mtimmerm@microstar.com (Matt Timmermans)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Why no allocator-specific delete?
  5. Date: 01 Feb 1996 09:26:44 PST
  6. Organization: Microstar Software Ltd.
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <4eqn5b$les@noc.tor.hookup.net>
  9. References: <4dvid8$460@news.bridge.net> <4e0u1s$5fv@engnews1.Eng.Sun.COM> <4e85k6$b04@noc.tor.hookup.net> <KANZE.96Jan29095513@slsvewt.lts.sel.alcatel.de>
  10. NNTP-Posting-Host: isolde.mti.sgi.com
  11. X-Original-Date: Thu, 01 Feb 1996 15:45:57 GMT
  12. X-Newsreader: Forte Free Agent v0.55
  13. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  14.     iQBVAwUBMRD360y4NqrwXLNJAQFyMwH/b1Zm9AssDyrf4wsP4mJx6JDPbEI8wF58
  15.     soNntttb4ukBX4+Gv1gnjiZIuBJ9uYSt53E7J2MfV0ht8WnLRtrEgQ==
  16.     =ltaq
  17. Originator: austern@isolde.mti.sgi.com
  18.  
  19. (kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763))
  20.  
  21. |   In article <4e85k6$b04@noc.tor.hookup.net> mtimmerm@microstar.com
  22. |   (Matt Timmermans) writes:
  23. |
  24. |   |   ...  I can't, in fact, think of a single way that
  25. |   |   placement-new could be used properly.
  26. |
  27. |   [two decent uses described]
  28. |
  29. |   |   The lack of a placement-delete is on of the many factors in C++ conspiring
  30. |   |   to make it absolutely impossible to make generic collections that hold
  31. |   |   actual objects (with constructors) instead of just pointers.
  32.  
  33. |   I don't understand the problem.  My containers all contain actual
  34. |   objects, and not just pointers.
  35.  
  36. I spoke somewhat too generally.  Let's say I want to make a generic list:
  37.  
  38. template <class T> class ListOf;
  39.  
  40. which stores acutal objects of type T (not just pointers) and contains
  41. methods to add and delete items from the list.  Lets say I also have a
  42. class:
  43.  
  44. class A
  45.     {
  46.     ...
  47.     public:
  48.     A(int alpha,int beta);
  49.     ~A();
  50.     };
  51.  
  52. Note that class A has no valid copy semantics.  How can I implement ListOf
  53. such that ListOf<int> and ListOf<A> both work?  There are lots of slimy
  54. hacks, but no elegant solutions.
  55.  
  56.  
  57. </Matt>
  58.  
  59. --------------------------------------------------------------
  60. Matt Timmermans               | Phone:  +1 613 596-2233
  61. Microstar Software Ltd.       | Fax:    +1 613 596-5934
  62. 3775 Richmond Rd.             | E-mail: mtimmerm@microstar.com
  63. Nepean Ontario CANADA K2H 5B7 | http://www.microstar.com
  64. ---
  65. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  66.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  67.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  68.